# 当前分支
branch=$(git branch | grep -e '^*' | cut -d' ' -f 2)

# 必须得在master下才可操作
if [ "$branch" == 'master' ]; then
  # 正常push及打tag操作
  git add . && git commit -m 'Auto-commit' && git push
  # tag
  git tag $(date +$1-"%Y-%m-%d.%H%M") && git push --tags

  # 获取最新tag
  # LatestTag=$(git describe --tags $(git rev-list --tags --max-count=1))

  # # 获取tag列表
  tagList=$(git tag --sort=taggerdate | head -n4)
  echo LatestTag
  # PS3="请输入对应tag编号: "
  # echo "请选择需要上线的tag(\033[31m${LatestTag}\033[0m为最新提交tag)?"
  # select item in $tagList; do
  #   break
  # done
  # echo "你选择上线的tag是 $item"

else
  echo 'please merge to master!'
fi
